import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
    {
    title: '栏目名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '栏目级别',
    align:"center",
    dataIndex: 'level'
   },
   {
    title: '排列顺序',
    align:"center",
    dataIndex: 'priority'
   },
   {
    title: '图片',
    align:"center",
    dataIndex: 'img',
    customRender:render.renderAvatar,
   },
   {
    title: '描述',
    align:"center",
    dataIndex: 'description'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '父级节点',
    field: 'pid',
    component: 'Input',
  },
  {
    label: '栏目名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入栏目名称!'},
          ];
     },
  },
  {
    label: '栏目级别',
    field: 'level',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '排列顺序',
    field: 'priority',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: false},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
  {
    label: '图片',
    field: 'img',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '描述',
    field: 'description',
    component: 'Input',
  },
];
